<?php
if (isset($buttons) && is_array($buttons)):
    foreach ($buttons as $key => $button):
        $extra = NULL;
        $button = !is_numeric($key) && ($extra = $button) ? $key : $button;
        switch ($button):
            case 'delete':
                ?>
                <button type="submit" name="btnAction" value="delete" class="button confirm">
                    <span><?php echo lang('delete_label'); ?></span>
                </button>
                <?php
        break;
            case 're-index':
                ?>
                <button type="submit" name="btnAction" value="re-index" class="button">
                    <span><?php echo lang('reindex_label'); ?></span>
                </button>
                <?php
        break;
            case 'activate':
            case 'deactivate':
            case 'approve':
            case 'publish':
            case 'save':
            case 'save_exit':
            case 'unapprove':
            case 'upload':
                ?>
                <button type="submit" name="btnAction" value="<?php echo $button ?>" class="button">
                    <span><?php echo lang($button . '_label'); ?></span>
                </button>
                <?php
        break;
            case 'cancel':
            case 'close':
            case 'preview':
                echo anchor('admin/' . $this->module_details['slug'], lang($button . '_label'), 'class="button ' . $button . '"');
                break;
            /**
             * @var        $id scalar - optionally can be received from an associative key from array $extra
             * @since    1.2.0-beta2
             */
            case 'edit':
                $id = is_array($extra) && array_key_exists('id', $extra) ? '/' . $button . '/' . $extra['id'] : NULL;
                echo anchor('admin/' . $this->module_details['slug'] . $id, lang($button . '_label'), 'class="button ' . $button . '"');
                break;
        endswitch;
    endforeach;
endif;
?>